<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div style="padding:10px;">
<form id="form-update">
	<div class="form-group">
    <label for="exampleInputEmail1">工号</label>
    <input type="text" class="form-control" name="emp_id" value="${emp.emp_id }" id="empName" placeholder="请输入姓名" readonly="readonly">
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">姓名</label>
    <input type="text" class="form-control" name="emp_name" value="${emp.emp_name }" id="empName" placeholder="请输入姓名">
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">月薪</label>
    <input type="text" class="form-control" name="emp_salary" value="${emp.emp_salary }" id="empSal" placeholder="请输入月薪">
  </div>
  <div class="form-group">
    <label for="exampleInputFile">时间</label>
    <input type="date" class="form-control" name="emp_date" value="${emp.emp_date }" id="empDate">
  </div>
  
  <button type="button" class="btn btn-info" data-id="${emp.emp_id }" id="bn-update">修改</button>
  <button type="button" onclick="layer.close(layIdx);" class="btn btn-info">取消</button>
</form>
</div>
<script>
	$("#bn-update").click(function(){
		/* var empId = $(this).attr('data-id');
		alert(empId); */
		$.ajax({
			url:'empServlet?operate=updateEmp',
			method:'post',
			data:$('#form-update').serialize(),
			dataType:'json'
		}).done(function(json){
			if(json.msg=="success"){
				layer.close(layIdx);
				loadEmpInfo();
			}
		});
	});
</script>